import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import Home from '@/views/Home.vue';
import TestOne from '@/views/TestOne.vue';
import TestTwo from '@/views/TestTwo.vue';

const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        name: 'Home',
        component: Home,
    },
    {
        path: '/Test1',
        name: 'Test1',
        component: TestOne,
    },
    {
        path: '/Test2',
        name: 'Test2',
        component: TestTwo,
    },
];

const router = createRouter({
    history: createWebHistory(),
    routes,
})

// 在这里添加路由的导航守卫
router.beforeEach((to, from, next)=> {
    console.log('Navigating to: ', to.path);
    next();
});

export default router;